﻿<sap:ActivityDesigner x:Class="Vision.Core.ActivityComponents.Diagnostics.EventLogDesigner"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:s="clr-namespace:System;assembly=mscorlib" 	
    xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
    xmlns:diag="clr-namespace:System.Diagnostics;assembly=mscorlib"
    Collapsible="True" ExpandState="True">
    <sap:ActivityDesigner.Resources>
        <sapc:ArgumentToExpressionConverter x:Key="argumentToExpressionConverter" />
        
        <DataTemplate x:Key="ExpandedActivityViewTemplate">
            <StackPanel>
                <!-- Inputs Header -->
                <TextBlock Text="Input(s):" FontWeight="Bold" Foreground="Navy" Margin="0,0,0,3" />

                <Grid Margin="0,5,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <!-- ModelItem.Source -->
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Source:" VerticalAlignment="Top" />
                    <sapv:ExpressionTextBox Grid.Row="1" Grid.Column="1"
                        MaxLines="1" Margin="7,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                        Expression="{Binding Path=ModelItem.Source, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                        ExpressionType="{Binding Path=ModelItem.Source.ArgumentType}"
                        OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                </Grid>

                <Grid Margin="0,5,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <!-- ModelItem.Message -->
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Message:" VerticalAlignment="Top" />
                    <sapv:ExpressionTextBox Grid.Row="1" Grid.Column="1"
                        MaxLines="1" Margin="7,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                        Expression="{Binding Path=ModelItem.Message, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                        ExpressionType="{Binding Path=ModelItem.Message.ArgumentType}"
                        OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                </Grid>
                
                <Grid Margin="0,5,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <!-- ModelItem.LogEntryType -->
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Entry Type:" VerticalAlignment="Top" />
                    <ComboBox x:Uid="cboLogEntryType" x:Name="cboLogEntryType" Grid.Row="1" Grid.Column="1" Margin="7,0,0,0" SelectedValue="{Binding Path=ModelItem.LogEntryType}" Loaded="cboLogEntryType_Loaded" />
                    <!--
                    <sapv:ExpressionTextBox Grid.Row="1" Grid.Column="1"
                        MaxLines="1" Margin="7,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                        Expression="{Binding Path=ModelItem.LogEntryType, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                        ExpressionType="{Binding Path=ModelItem.LogEntryType.ArgumentType}"
                        OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                    -->
                </Grid>

                <Grid Margin="0,5,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <!-- ModelItem.LogName -->
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Log Name:" VerticalAlignment="Top" />
                    <sapv:ExpressionTextBox Grid.Row="1" Grid.Column="1"
                        MaxLines="1" Margin="7,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                        Expression="{Binding Path=ModelItem.LogName, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                        ExpressionType="{Binding Path=ModelItem.LogName.ArgumentType}"
                        OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                </Grid>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Uid="DataTemplate_2" x:Key="CollapsedActivityViewTemplate">
            <Label x:Uid="TextBlock_6" Padding="0,0,0,0" FontStyle="Italic" Foreground="{x:Static SystemColors.GrayTextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">Double-click to view</Label>
        </DataTemplate>
        <Style x:Uid="Style_1" x:Key="CollapsibleStyle" TargetType="{x:Type ContentPresenter}">
            <Setter x:Uid="Setter_1" Property="ContentTemplate" Value="{DynamicResource ExpandedActivityViewTemplate}" />
            <Style.Triggers>
                <DataTrigger x:Uid="DataTrigger_1" Binding="{Binding Path=ShowExpanded}" Value="false">
                    <Setter x:Uid="Setter_2" Property="ContentTemplate" Value="{DynamicResource CollapsedActivityViewTemplate}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </sap:ActivityDesigner.Resources>
    <ContentPresenter x:Uid="ContentPresenter_1" Style="{DynamicResource CollapsibleStyle}" Content="{Binding}" />
</sap:ActivityDesigner>
